"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));

var _jsxRuntime = require("react/jsx-runtime");

var _icons = require("@ant-design/icons");

var _proProvider = require("@ant-design/pro-provider");

var _proUtils = require("@ant-design/pro-utils");

var _antdV = require("antd-v4");

var _react = _interopRequireWildcard(require("react"));

var FullScreenIcon = function FullScreenIcon() {
  var intl = (0, _proProvider.useIntl)();

  var _useState = (0, _react.useState)(false),
      _useState2 = (0, _slicedToArray2.default)(_useState, 2),
      fullscreen = _useState2[0],
      setFullscreen = _useState2[1];

  (0, _react.useEffect)(function () {
    if (!(0, _proUtils.isBrowser)()) {
      return;
    }

    document.onfullscreenchange = function () {
      setFullscreen(!!document.fullscreenElement);
    };
  }, []);
  return fullscreen ? (0, _jsxRuntime.jsx)(_antdV.Tooltip, {
    title: intl.getMessage('tableToolBar.exitFullScreen', '全屏'),
    children: (0, _jsxRuntime.jsx)(_icons.FullscreenExitOutlined, {})
  }) : (0, _jsxRuntime.jsx)(_antdV.Tooltip, {
    title: intl.getMessage('tableToolBar.fullScreen', '全屏'),
    children: (0, _jsxRuntime.jsx)(_icons.FullscreenOutlined, {})
  });
};

var _default = /*#__PURE__*/_react.default.memo(FullScreenIcon);

exports.default = _default;